//
//  YMFOrderModel.swift
//  FlyingPigeon
//
//  Created by yang on 2019/5/26.
//  Copyright © 2019年 a. All rights reserved.
//

import Foundation
import UIKit

class YMFOrderModel: NSObject, NSCoding {
    var orderCode = ""
    var carName = ""
    var carPrice = ""
    var userName = ""
    var userPhone = ""
    var totalPrice = ""
    var carImage = ""
    var begainDate: Date?
    var endDate : Date?
    var placeName = ""
    
    
    override init() {
        super.init()
    }
    
    
    func encode(with aCoder: NSCoder) {
        
        aCoder.encode(orderCode, forKey: "orderCode")
        aCoder.encode(carName, forKey: "carName")
        aCoder.encode(carPrice, forKey: "carPrice")
        aCoder.encode(userName, forKey: "userName")
        aCoder.encode(userPhone, forKey: "userPhone")
        aCoder.encode(totalPrice, forKey: "totalPrice")
        aCoder.encode(carImage, forKey: "carImage")
        aCoder.encode(begainDate, forKey: "begainDate")
        aCoder.encode(endDate, forKey: "endDate")
        aCoder.encode(placeName, forKey: "placeName")
    }
    
    required init?(coder aDecoder: NSCoder) {
        orderCode = aDecoder.decodeObject(forKey: "orderCode") as? String ?? ""
        carName = aDecoder.decodeObject(forKey: "carName") as? String ?? ""
        carPrice = aDecoder.decodeObject(forKey: "carPrice") as? String ?? ""
        userName = aDecoder.decodeObject(forKey: "userName") as? String ?? ""
        userPhone = aDecoder.decodeObject(forKey: "userPhone") as? String ?? ""
        totalPrice = aDecoder.decodeObject(forKey: "totalPrice") as? String ?? ""
        
        carImage = aDecoder.decodeObject(forKey: "carImage") as? String ?? ""
        begainDate = aDecoder.decodeObject(forKey: "begainDate") as? Date
        endDate = aDecoder.decodeObject(forKey: "endDate") as? Date
        placeName = aDecoder.decodeObject(forKey: "placeName") as? String ?? ""
    }
    
    
}
